// 在这个文件内书写所有的封装函数
// 把和商品相关的所有请求都封装成 hooks 函数

// 导入 axios 的实例
import http from '../utils/http'

export const getBannerList = () => http.get('/banner/list')

export const getHotList = () => http.get('/pro/seckilllist?limitNum=12')

export const getGoodsList = (count: number) => http.get('/pro/list?count=' + count)

export const getHotSearchList = () => http.get('/pro/hotword')

export const getSearchList = (keyword: string) => http.get('/pro/search?keyword=' + keyword)

export const getCateList = () => http.get('/pro/categorylist')

export const getBrandList = (category: string) => http.get('/pro/categorybrandlist?category=' + category)

export const getGoodsForCateAndBrand = (category: string, brand: string) => http.get('/pro/categorybrandprolist', {
  params: {
    category,
    brand,
    count: 1,
    limitNum: 10
  }
})

export const getGoodsDetailHandler = (proid: string) => http.get('/pro/detail/' + proid)
